package com.dao.impl;

import com.dao.DaoHelper;
import com.dao.StudentDao;
import com.entity.Student;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

/**
 * Student 持久层实现
 *
 * @author lizan
 */
@Repository("studentDao")
public abstract class StudentDaoImpl implements StudentDao {

    @Autowired
    private DaoHelper helper;

    private final String tableName = "student";
    private final String baseField = "(sid,name,english_name,address,phone_number,birthday");

@Override
    public int insert(Student student) {
    String sql= "insert into " + tableName + baseField +
            " values (" + "'" + student.getSid()+
            "','" + student.getName()
                    +"','" + student.getEnglishName()
                    +"','" +student.getAddress()
                    +"','"+student.getPhoneNumber()
                    +"','" +student.getBirthday()
                    +"');";
    return helper.insert(sql);
    }

    @Override
    public int queryTotalCount() { return 0; }
}
